#include <iostream>

using namespace std;

const int N = 1e5 + 10;

int n, q, k;
int nums[N];

int left_bound(int target){
    int l = 0, r = n - 1;
    while(l < r){
        int mid = (l+r)  / 2;
        if(nums[mid] == target){
            r = mid ;
        }else if(nums[mid] > target){
            r = mid - 1;
        }else if(nums[mid] < target){
            l = mid + 1;
        }
    }

    if(l >= n || target != nums[l])  return -1;
    return l;

}

int right_bound(int target){
    int l = 0, r = n - 1;
    while(l < r){
        int mid = (l+r+1)  / 2;
        if(nums[mid] == target){
            l = mid ;
        }else if(nums[mid] > target){
            r = mid - 1;
        }else if(nums[mid] < target){
            l = mid + 1;
        }
    }

    if(r < 0 || target != nums[r])  return -1;
    return r;
}

int main(){
    cin >> n >> q;
    int l, r;
    for(int i = 0; i < n; i++)      cin >> nums[i];

    while(q--){
        cin >> k;
        //求左端点
        l = left_bound(k);
        if(l == -1)     cout << "-1 -1" << endl;
        else{
            //求右端点
            r = right_bound(k);
            cout << l << " " << r << endl;
        }

    }

    return 0;
}


